package com.youlu.campus.admin.zm.msg;

import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.youlu.campus.admin.zm.enums.MsgTypeEnum;
import com.youlu.campus.admin.zm.enums.SmartMsgEnum;
import lombok.Data;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;

import java.util.LinkedList;
import java.util.List;

/**
 * @author : [dengbo]
 * @className : SmartMenuMsg
 * @description : [智能菜单消息]
 * @createTime : [2022/11/11 14:50]
 */
@Data
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
@Slf4j
@ToString(callSuper = true)
public class SmartMenuMsg extends MsgObject{
    public SmartMenuMsg(){
        this.msgType = MsgTypeEnum.SMART_MENU.getValue();
    }
    private String headContent;
    private List<SmartMsg> list = new LinkedList<>();

    public SmartMenuMsg addMsg(SmartMsg content){
        list.add(content);
        return this;
    }

    public static abstract class SmartMsg{
        protected String type;

        public String getType() {
            return type;
        }
    }

    public static class SmartTextMsg extends SmartMsg{
        public SmartTextMsg(){
            this.type = SmartMsgEnum.TEXT.getValue();
        }

        private SmartTextContent text;

        public void setText(SmartTextContent text) {
            this.text = text;
        }

        public SmartTextContent getText() {
            return text;
        }
    }

    public static class SmartViewMsg extends SmartMsg{
        public SmartViewMsg(){
            this.type = SmartMsgEnum.VIEW.getValue();
        }
        private SmartViewContent view;

        public SmartViewContent getView() {
            return view;
        }

        public void setView(SmartViewContent view) {
            this.view = view;
        }
    }

    public static class SmartClickMsg extends SmartMsg{
        public SmartClickMsg(){
            this.type = SmartMsgEnum.CLICK.getValue();
        }
        private SmartClickContent click;

        public void setClick(SmartClickContent click) {
            this.click = click;
        }

        public SmartClickContent getClick() {
            return click;
        }
    }

    public static abstract class SmartBaseContent{
        protected String content;

        public void setContent(String content) {
            this.content = content;
        }

        public String getContent() {
            return content;
        }
    }

    public static class SmartTextContent extends SmartBaseContent{
    }

    public static class SmartClickContent extends SmartBaseContent{
        private String id;

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }
    }

    public static class SmartViewContent extends SmartBaseContent{
        private String url;

        public void setUrl(String url) {
            this.url = url;
        }

        public String getUrl() {
            return url;
        }
    }

}